import gtk


class gbErrorMsgbox(object):
    def __init__(self,message, modal=False, parent = None):
        self.msg = gtk.MessageDialog(type=gtk.MESSAGE_ERROR,buttons=gtk.BUTTONS_CLOSE, parent = None)
        
        def set_focus(widget,msg):
            """
            methinks the gtk.Window methods could do with some documentation strings

            (
            i.e. this is where we have to set the focus onto the msg Dialog - using a method
            inherited from gtk.Window - but this module seems completely undocumented in the
            docstrings and I'm nowhere near the internet right now :-(
            )
            """
            pass


        self.msg.set_markup(message)

        if modal:
            self.msg.set_modal(True)
            self.msg.connect("focus-out-event", set_focus )

        self.run = self.msg.run
        self.destroy = self.msg.destroy


class gbConfirmMsgbox(object):
    def __init__(self,message,modal=False):
        self.msg = gtk.MessageDialog(type=gtk.MESSAGE_WARNING,buttons=(gtk.BUTTONS_OK_CANCEL))

        def set_focus(widget,msg):
            #TODO
            pass

        self.msg.set_markup(message)
        if modal:
            self.msg.set_modal(True)
            self.msg.connect("focus-out-event", set_focus)
        self.run = self.msg.run
        self.destroy = self.msg.destroy



class gbYesNoMsgbox(object):
    def __init__(self,message,modal=False):
        self.msg = gtk.MessageDialog(type=gtk.MESSAGE_WARNING,buttons=(gtk.BUTTONS_YES_NO))

        def set_focus(widget,msg):
            #TODO
            pass

        self.msg.set_markup(message)
        if modal:
            self.msg.set_modal(True)
            self.msg.connect("focus-out-event", set_focus)
        self.run = self.msg.run
        self.destroy = self.msg.destroy



